{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c43cbf31-53d0-4c5e-a495-9703c60875d5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Michael', 'Sarah', 'Tracy', 'Bob', 'Jack']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "L=['Michael', 'Sarah', 'Tracy', 'Bob', 'Jack']\n",
    "L"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "fe426934-d31c-4957-bfc9-882e267da5bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Michael', 'Sarah', 'Tracy']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "L[0:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "375c7e49-b903-43a7-b6df-e236b63d7c82",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Michael', 'Sarah', 'Tracy']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "L[:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "13ef1240-f751-4417-92ea-c60668861715",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Jack'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "L[-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7fe31689-d51d-46ef-b2d6-8e5e9c7f8aae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0, 1, 2)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(0,1,2,3,4,5)[:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "cafdc3d4-b3aa-485c-9ef9-9abf8dbf2a65",
   "metadata": {},
   "outputs": [],
   "source": [
    "def trim(s): \n",
    "    for x in range(len(s) - 1 ):\n",
    "        if s[x:x+1] == ' ':\n",
    "            pass\n",
    "        else:\n",
    "            first = x;\n",
    "            if s[x:x+1] != ' ':\n",
    "                pass\n",
    "            else: \n",
    "                return s[first:x-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "9dba177e-5831-47bd-a3ee-054b1ae8da68",
   "metadata": {},
   "outputs": [],
   "source": [
    "trim(\"  ds \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "da3ebf09-7387-40dc-8fa2-72dfeb9bfb26",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a\n",
      "b\n",
      "c\n"
     ]
    }
   ],
   "source": [
    "d = { 'a': 1, 'b': 2, 'c': 3}\n",
    "for key in d: \n",
    "    print(key)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "042868a3-e2bc-4209-99cb-c711e1359796",
   "metadata": {},
   "outputs": [],
   "source": [
    "from collections import Iterable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "56a2aa09-fe63-4f1f-8034-efd4dabd293d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance('abc', Iterable)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "b471de04-3750-4309-a296-110d3cde6216",
   "metadata": {},
   "outputs": [],
   "source": [
    "from collections.abc import Iterable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "5d4bb3c4-0c33-40ce-86c2-a366b9eaa4e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance('abc', Iterable)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "85e049ab-a7b2-43da-a81b-17e13a317c62",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance([1,2,3], Iterable)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "61b82325-a211-4310-907a-47cbd857ca61",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 a\n",
      "1 b\n",
      "2 c\n"
     ]
    }
   ],
   "source": [
    "for i, value in  enumerate(['a', 'b','c']):\n",
    "    print(i, value)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "90bdcfb3-6301-492a-a4b0-3a91b929bf93",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
